import request from '@/utils/request'

export default {
  getBillList(searchModel) {
    return request({
      url: '/api/bill/list',
      method: 'get',
      params: {
        pageNum: searchModel.pageNum,
        pageSize: searchModel.pageSize,
        billStatus: searchModel.billStatus,
        title: searchModel.title,
        searchUserId: searchModel.userId
      }
    })
  },

  getBillById(id) {
    return request({
      url: `/api/bill/detail/${id}`,
      method: 'get'
    })
  },

  addBill(bill) {
    return request({
      url: '/api/bill/save',
      method: 'post',
      data: bill
    })
  },

  updateBill(bill) {
    return request({
      url: '/api/bill/update',
      method: 'post',
      data: bill
    })
  },
  saveBill(bill) {
    if (bill.id == null && bill.id == undefined) {
      return this.addBill(bill);
    }
    return this.updateBill(bill);
  },

  auditBill(auditBill) {
    return request({
      url: '/api/bill/audit',
      method: 'post',
      data: auditBill
    })
  }

}
